import request from '@/utils/request'

const api = {
  list: '/inspection-image/list',
  query: '/inspection-image/query',
  add: '/inspection-image/add',
  delete: '/inspection-image/delete',
  detail: '/inspection-image/detail',
  upload: '/inspection-image/upload',
  download: '/inspection-image/download'
}

export default {
  // 获取巡检图片列表
  list(params) {
    return request({
      url: api.list,
      method: 'get',
      params
    })
  },
  
  // 查询巡检图片
  query(params) {
    return request({
      url: api.query,
      method: 'get',
      params
    })
  },
  
  // 新增巡检图片记录
  add(data) {
    return request({
      url: api.add,
      method: 'post',
      data
    })
  },
  
  // 删除巡检图片
  delete(id) {
    return request({
      url: `${api.delete}/${id}`,
      method: 'delete'
    })
  },
  

  
  // 获取巡检图片详情
  detail(id) {
    return request({
      url: `${api.detail}/${id}`,
      method: 'get'
    })
  },
  
  // 上传图片
  upload(data) {
    return request({
      url: api.upload,
      method: 'post',
      data,
      headers: {
        'Content-Type': 'multipart/form-data'
      }
    })
  },
  
  // 下载图片
  download(id) {
    return request({
      url: `${api.download}/${id}`,
      method: 'get',
      responseType: 'blob'
    })
  }
}